//
//  SFilmCollectionViewCell.m
//  News
//
//  Created by dlios on 15-5-14.
//  Copyright (c) 2015年 PEAK. All rights reserved.
//

#import "SFilmCollectionViewCell.h"
#import "UIImageView+WebCache.h"



@interface SFilmCollectionViewCell ()
@property(nonatomic, retain)UIImageView *pic;
@property(nonatomic, retain)UILabel *name;

//@property(nonatomic, retain)UIButton *button;


@end
@implementation SFilmCollectionViewCell
- (void)dealloc
{
    [_pic release];
    [_name release];
    [super dealloc];
}
#warning 初始化 创建控件
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.pic = [[UIImageView alloc] init];
        [self.contentView addSubview:_pic];
        [_pic release];
        
        self.name = [[UILabel alloc] init];
        [self.contentView addSubview:_name];
        [_name release];

    }
    return self;
}
#warning 布局信息
-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _pic.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width / 4.2, self.contentView.frame.size.height - 30);
    
    _name.frame = CGRectMake(0, _pic.frame.size.height , _pic.frame.size.width, 30);
    
    
}

#warning 给控件赋值
-(void)setSfilm:(SfilmObject *)Sfilm
{
    if (_Sfilm != Sfilm) {
        [_Sfilm release];
        _Sfilm = [Sfilm retain];
        
    }
    
       [_pic sd_setImageWithURL:[Sfilm.images objectForKey:@"large"]placeholderImage:[UIImage imageNamed:@"``_3(NZ4U{L@4L7FN0J70DA"]];
    
    _name.text = Sfilm.Mytitle;
    

    
}



@end
